import request from '../utils/request'

const api_name = '/admin/hosp/hospitalSet'

const hos_url = '/admin/hosp/hospital'
const dict_url = '/admin/cmn/dict'
const dept_url = '/admin/hosp/department'
const schedule_url = '/admin/hosp/schedule'

export default {
  // 医院列表
  getPageList(page, limit, searchObj) {
    return request({
      url: `${api_name}/list/${page}/${limit}`,
      method: 'get',
      params: searchObj
    })
  },

  // 根据dict_code查询某个类型下的所有子节点
  findByDictCode(dictCode) {
    return request({
      url: `${dict_url}/findByDictCode/${dictCode}`,
      method: 'get'
    })
  },

  // 根据id查询下级数据字典
  findByParentId(parentId) {
    return request({
      url: `${dict_url}/findChildData/${parentId}`,
      method: 'get'
    })
  },

  // 更新接口的上线状态
  updateStatus(id, status) {
    return request({
      url: `${hos_url}/updateStatus/${id}/${status}`,
      method: 'get'
    })
  },

  // 查看医院详情
  getHospById(id) {
    return request({
      url: `${hos_url}/showHospDetail/${id}`,
      method: 'get'
    })
  },

  // 根据hoscode查询各部门信息
  getDeptByHoscode(hoscode) {
    return request({
      url: `${dept_url}/getDeptList/${hoscode}`,
      method: 'get'
    })
  },

  // 根据hoscode和depcode获取排班分页信息
  getScheduleRule(page, limit, hoscode, depcode) {
    return request({
      url: `${schedule_url}/getScheduleRule/${page}/${limit}/${hoscode}/${depcode}`,
      method: 'get'
    })
  },

  // 根据hoscode和deptcode和workDate获取每日的排班详细信息
  getScheduleDetail(hoscode, deptcode, workDate) {
    return request({
      url: `${schedule_url}/getScheduleDetail/${hoscode}/${deptcode}/${workDate}`,
      method: 'get'
    })
  }

}
